package main

import (
	"fmt"
	"time"
)

func hello(done chan int){
	fmt.Println("hello--->")
	time.Sleep(5*time.Second)
	done <- 33
	fmt.Println("set chan done ")
}

//chanel 切片
func test2(){
	job := make(chan int)
	jobpool := make(chan chan int, 2)
	fmt.Printf("__%T \n", jobpool)
	go func() {
		//job <- 10
		jobpool <- job
		jobChan := <-jobpool
		jobChan <- 20 //实际上是写入到job里
	}()
	v := <- job

	fmt.Println(v)

}



//信道 channel
func main() {
	fmt.Println("hello")
	//done := make(chan int)
	//go hello(done)
	//<- done //读取信道 done的值

	//defer func() {
	//	<-make(chan bool)
	//}()

	test2()

	fmt.Println("main function end")
}
